"use strict";

const Joi = require('joi');
const Result = require("../basics/result");
const CheckUtil = require("../utils/check");
const BasicsCtl = require("../basics/clz/basectl");
const HomeImpl = require("../service/home");
const UserUtil = require("../taobao/user");

class HomeCtl extends BasicsCtl {

  constructor(context) {
    super(context);
    this.homeImpl = new HomeImpl(this.cloud);
  }

  /**
   * 查询div高度
   */
  async findDivHeight() {
    return await this.homeImpl.findDivHeight();
  }

  /**
   * 查询会员
   * @returns 
   */
  async findMember() {
    const rule = {
      shopseesion: Joi.string().required()
    }
    CheckUtil.validate(rule, this.params);
    let { shopseesion, mixNick } = this.params;
    let user = await UserUtil.selectMember(this.cloud, shopseesion, mixNick);
    user.startTime = "2024/08/01 00:00:00";
    user.endTime = "2024/08/31 23:59:59"
    return user;
  }

}
module.exports = HomeCtl;